<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
	<style type="text/css">
		    body{
			    background-color:rgb(177, 208,224); font: normal 12px Trebuchet MS; color:#000;
		    }
		    .roundedCorners{ 
			    width:240px; padding:10px;
			    background-color:#DDEEF6; 
			    box-shadow: 0px 0px 10px 0px #888888;
			    border:1px solid #DDEEF6;
			    border-radius:6px;
			    margin: auto;
		    }
		    .roundedCorners-textbox{ 
				border:1px solid #999; width:160px;
		    }
			.checkbox {
				margin-left: 30px;
				border:1px solid #999; width:20px;
			}
	</style>
</head>
<script src="js/base.js"></script>
<script>
	onload = function(){
		alert(document.cookie);
		document.getElementById("username").value = getCookie("user");
		document.getElementById("password").value = getCookie("pwd");
		
		var btn = document.getElementById("submitbtn");
		var auto = document.getElementById("isAutoLogin");
		
		btn.addEventListener("click",function(e){
			e.preventDefault();
			var username = document.getElementById("username").value;
			var password = document.getElementById("password").value;
			
			if(auto.checked){
				setCookie("user", username, 10);
				setCookie("pwd", password, 10);
			} else {
				setCookie("user", username, -2);
				setCookie("pwd", password, -1);
			}
			document.getElementById("myform").submit();
		});
	}
	
</script>
<body>
	<form id="myform" action="www.baidu.com">	
		<div class="roundedCorners">
			<p>
				<label>账号</label>&nbsp;
				<input id="username" type="text" class="roundedCorners-textbox" />
			</p>
			<p>
				<label>密码</label>&nbsp;
				<input id="password" type="password" class="roundedCorners-textbox" />
				<span>show</span>
			</p>
			<p>
				<input id="isAutoLogin" name="saveNP" type="checkbox" class="checkbox" />
				<label>10天内免登陆</label>
		    </p>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<button id="submitbtn" >确定</button>
			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<input type="reset" value="清空" />
		</div>
	</form>	
</body>
</html>
